﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace IPCLibraryTestApp
{
	public partial class ReadWriteMessageControl : UserControl
	{
		public event EventHandler<EventArgs> ReadClicked;
		public event EventHandler<EventArgs> WriteClicked;
		public bool EnableRead
		{
			get { return btnRead.Enabled; }
			set { btnRead.Enabled = value; }
		}
		public ReadWriteMessageControl()
		{
			InitializeComponent();
		}
		public string ReadText
		{
			get { return textBoxRead.Text; }
			set { textBoxRead.Text = value; }
		}
		public string WriteText
		{
			get { return textBoxWrite.Text; }
			set { textBoxWrite.Text = value; }
		}

		private void ReadWriteMessageControl_Load(object sender, EventArgs e)
		{
			textBoxRead.Text = String.Empty;
			textBoxWrite.Text = string.Empty;
		}

		private void btnWrite_Click(object sender, EventArgs e)
		{
			if (WriteClicked != null)
			{
				WriteClicked(this, EventArgs.Empty);
			}
		}

		private void btnRead_Click(object sender, EventArgs e)
		{
			if (ReadClicked != null)
			{
				ReadClicked(this, EventArgs.Empty);
			}
		}
	}
}
